home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / pascalt2.zip / FINDCHRS.PAS < prev    next >
Pascal/Delphi Source File  |  1988-01-15  |  1KB  |  35 lines

  1.                                 (* Chapter 8 - Program 4 *)
  2. program Find_All_Lower_Case_Characters;
  3.  
  4. const String_Size = 30;
  5.  
  6. type Low_Set = set of 'a'..'z';
  7.  
  8. var Data_Set    : Low_Set;
  9.     Storage     : string[String_Size];
  10.     Index       : 1..String_Size;
  11.     Print_Group : string[26];
  12.  
  13. begin  (* main program *)
  14.    Data_Set := [];
  15.    Print_Group := '';
  16.    Storage := 'This is a set test.';
  17.  
  18.    for Index := 1 to Length(Storage) do begin
  19.       if Storage[Index] in ['a'..'z'] then begin
  20.          if Storage[Index] in Data_Set then
  21.             Writeln(Index:4,'   ',Storage[Index],
  22.                          ' is already in the set')
  23.          else begin
  24.             Data_Set := Data_Set + [Storage[Index]];
  25.             Print_Group := Print_Group + Storage[Index];
  26.             Writeln(Index:4,'   ',Storage[Index],
  27.                          ' added to group, complete group = ',
  28.                          Print_Group);
  29.          end;
  30.       end
  31.       else
  32.          Writeln(Index:4,'   ',Storage[Index],
  33.                        ' is not a lower case letter');
  34.    end;
  35. end.  (* of main program *)